package jxtend.processor.eclipse.visitor.interceptor;

import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;

@SuppressWarnings("restriction")
public class ResolveTypesForMethodBindingInterceptor extends ASTNodeVisitorInterceptorAdapter {

	@Override
	public boolean interceptVisit(ASTNodeVisitorInterceptorContext interceptorChain, ASTNode node, Scope scope) {
		if (node instanceof MethodDeclaration && ((MethodDeclaration) node).binding != null) {
			MethodDeclaration methodDeclaration = (MethodDeclaration) node;
			MethodBinding methodBinding = methodDeclaration.binding;
			
			SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) methodBinding.declaringClass;
			sourceTypeBinding.resolveTypesFor(methodBinding);
		}

		return super.interceptVisit(interceptorChain, node, scope);
	}

	
}
